<?php
namespace app\admin\validate;

use app\validate\BaseValidate;

class ProductCategory extends BaseValidate
{
    /**
     * 定义验证规则
     * 格式：'字段名'=>['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'=>'number',
        'name'=>'require',
        'pid'=>'number',
        'pic'=>'canBeEmpty',
        'sort'=>'canBeEmpty'
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'=>'错误信息'
     *
     * @var array
     */
    protected $message = [
       
    ];
    /**
     * 定义验证场景
     * 格式：'场景名'=>['规则1','规则2',...]
     *
     * @var array
     */
    protected $scene = [
        'save'=>['name','pic','pid','sort'],
        'delete'=>['id'],
        'update'=>['id','name','pic','pid','sort'],
        'read'=>['id']
    ];
}
